<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>问答系统首页</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="keywords" content="">
	<meta name="description" content="">
	<link rel="stylesheet" href="__BBS_Module__/layui/css/layui.css">
	<link rel="stylesheet" href="__BBS_Module__/css/global.css">
	<script src="__BBS_Module__/layui/layui.js"></script>
	<link rel="stylesheet" href="/public/bbs/readarticle/select.css" crossorigin="anonymous">
	<script src="/public/jquery/jquery-3.3.1.min.js"></script>
</head>

<body>
	{$head}

	<div class="global main ">
		<div class="global wrap">
			<div class="global content" style="margin-right:0">
				<div class="global fly-tab">

					<!-- <span>
          <a href="" class="global tab-this">全部</a>
          <a href="">未结帖</a>
          <a href="">已采纳</a>
          <a href="">置顶帖</a>
          <a href="../user/index.html">我的帖</a>
        </span> -->
					<div style="text-align:center; width: 85%" class="global input-group mb-3">
						<div class="global input-group-prepend">
							<label class="global input-group-text" for="inputGroupSelect01">请选择分类</label>
						</div>
						<select onchange="select_class()" class="global custom-select" id="inputGroupSelect01">
							{if condition='$class_id == 0'}
							<option value="0" selected>全部</option>
							{else/}
							<option value="0">全部</option>
							{/if}
							{volist name='bbs_article_class_list' id='vo'}
							{if condition='$class_id == $vo.id'}
							<option value="{$vo.id}" selected>{$vo.class_name}</option>
							{else/}
							<option value="{$vo.id}">{$vo.class_name}</option>
							{/if}
							{/volist}
						</select>
					</div>
					<div>
						{if condition='$bbs_classification_info["son_class_release"] == 0'}
						<a style="width: 15%" href="{:url('bbs/publish_articles/index')}?ReleaseAlias={$alias}"
							class="global layui-btn jie-add">发布问题</a>
						{else/}
						<a style="width: 15%" class="global layui-btn layui-btn-disabled jie-add">发布问题</a>
						{/if}

					</div>
				</div>

				<ul id='main_list' class="global fly-list">
					{volist name='list' id='vo'}
					<li class="global fly-list-li">
						<a href="../user/home.html" class="global fly-list-avatar">
							<img src="{$vo.head_src}" alt="">
						</a>
						<h2 class="global fly-tip">
							<a href="{:url('bbs/readarticle/index')}?id={$vo.id}">
								{if condition='$vo.start == 3'}
								<p style="color: red;">[登陆后可阅读]</p>
								{else/}
								{/if}

								{$vo.title}
							</a>
							{if condition="$vo.top"}
							<span class="global fly-tip-stick">置顶</span>
							{/if}
						</h2>
						<p>
							<span>
								<a href="">
									发布人
									{if condition="$vo.nickname"}
									{$vo.nickname}
									{else\}
									{if condition="$vo.user_name"}
									{$vo.user_name}
									{/if}
									{/if}
								</a>
							</span>
							<span>发布时间 {$vo.release_time}</span>
							<span class="global fly-list-hint">
								<i class="global iconfont" title="回复">&#xe60c;</i> {$vo.count}
							</span>
						</p>
					</li>
					{/volist}

				</ul>

				<!-- <div class="global fly-none">并无相关数据</div> -->

				{$page}

			</div>
		</div>
	</div>
	<script>
		function select_class() {
			$.ajax({
				type: "POST",
				url: "{:url('bbs/articlelist/get_class_list')}",
				data: {
					class_id: $('select  option:selected').val(),
					alias: '{$alias}',
				},
				dataType: "JSON",
				success: function (response) {
					if (response.code) {
						var html = '';
						response.data.forEach(value => {
							html +=
								'<li class="global fly-list-li">' +
								'	<a href="../user/home.html" class="global fly-list-avatar">' +
								'		<img src="' + value.head_src + '" alt="">' +
								'	</a>' +
								'	<h2 class="global fly-tip">' +
								'		<a href="/bbs/readarticle/index?id=' + value.id + '">';
							if (value.start == 3) {
								html += '<p style="color: red;">[登陆后可阅读]</p>';

							}
							html += value.title +
								'</a>';
							if (value.top) {
								html += '		<span class="global fly-tip-stick">置顶</span>';
							}
							html += '	</h2>' +
								'	<p>' +
								'		<span> 发布人 <a href="">';
							// user_jurisdiction
							// user_name
							if (value.nickname) {
								html += value.nickname;
							} else {
								html += value.user_name;
							}

							html += '</a></span>' +
								'		<span> 发布时间';
							html += value.release_time;
							html += '</span>' +
								'		<span class="global fly-list-hint">' +
								'			<i class="global iconfont" title="回复">&#xe60c;</i>' +
								value.count +
								'		</span>' +
								'	</p>' +
								'</li>';
						});
						$('#main_list').empty();
						$('#main_list').append(html);
						$('#page_list').empty();
						$('#page_list').append(response.page_html);


					}
				}
			});
		}
	</script>
</body>

</html>